<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../src/all.css" media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>

<body style="background:#FFF">
  <!--navTabAjaxDone,dialogAjaxDone  -->
  <form class="layui-form" action="">
    <blockquote class="layui-elem-quote layui-text">
      信息详情
    </blockquote>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
      <legend>信息详情</legend>
    </fieldset>
    <!--<input id="hpflownods" name="hpflownods" type="hidden" value="" />-->
    <input name="isadd" type="hidden" value="$!isadd" />
    <!--是否第一次添加 0第一次 1不是第一次-->
    <input name="add" type="hidden" value="dict_code" />
    <div class="layui-form-item">
      <label class="layui-form-label">字典名称</label>
      <div class="layui-input-block">
        <input type="text" name="dict_code" lay-verify="required" autocomplete="off" placeholder="请输入字典名称"
          class="layui-input" value="$!dict_code">
      </div>
    </div>
    <input name="add" type="hidden" value="dict_text" />
    <div class="layui-form-item">
      <label class="layui-form-label">字典内容</label>
      <div class="layui-input-block">
        <input type="text" name="dict_text" lay-verify="required" autocomplete="off" placeholder="请输入字典内容"
          class="layui-input" value="$!dict_text">
      </div>
    </div>
    <input name="add" type="hidden" value="sort" />
    <div class="layui-form-item">
      <label class="layui-form-label">排序</label>
      <div class="layui-input-block">
        <input type="text" name="sort" lay-verify="required" autocomplete="off" placeholder="请输入字典内容"
          class="layui-input" value="$!sort">
      </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="layajax_add">立即提交</button>
    </div>
  </form>

  <script src="layuiadmin/layui/layui.js"></script>
  <script>
    layui.use(['form', 'layedit', 'laydate'], function () {
      var form = layui.form
        , $ = layui.jquery
        , layer = layui.layer
        , layedit = layui.layedit
        , laydate = layui.laydate;

      //日期
      laydate.render({
        elem: '.date_lay'
      });

      //创建一个编辑器
      var editIndex = layedit.build('LAY_demo_editor');

      //监听指定开关
      form.on('switch(switchTest)', function (data) {
        layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
          offset: '6px'
        });
        layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
      });

      //监听提交
      form.on('submit(layajax_add)', function (data) {
        $.ajax({
          url: '$cls.getrooturl()?type=add&id=$!{id}&mid=$!{mid}&tabid=$!{tabid}&job=${job}&tbname=${tbname}',
          type: 'post',
          dataType: 'json',
          data: $("form").serialize(),
          success: function (data) {
            console.log(data);
            if (data.statusCode == '200') {
              layer.msg(data.message, { icon: 6 }, function () {
                layer.closeAll();
              });
            } else {
              layer.msg(data.message, { icon: 5, anim: 6 });
            }
          },
          error: function () {
            layer.msg("操作失败", { icon: 5, anim: 6 });
          }
        })

        return false;
      });

    });
  </script>
</body>

</html>